import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    ART,
    TouchableOpacity,
    Dimensions,
} from 'react-native';
/**
 * 由 WangYu 创建
 * 日期 2017/9/27
 */
const {Surface, Shape, Path} = ART;
let screenWidth=Dimensions.get('window').width;
export default class DashedLine extends Component {
    static defaultProps={
        width:screenWidth,
    }

    constructor(props) {
        super(props);
    }

    render() {
        let padding=(screenWidth-this.props.width)/2;
        const path = Path()
            .moveTo(1,1)
            .lineTo(padding+this.props.width,1);

        return(
            <View style={[this.props.style,{alignItems:'center'}]}>
                <Surface width={this.props.width} height={2}>
                    <Shape d={path} stroke="#bbbbbb" strokeWidth={1} strokeDash={[5,5]}/>
                </Surface>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        height:1,
        borderStyle:'dashed',
        borderBottomWidth:1,
        borderBottomColor:'#333333',
        alignSelf:'stretch'
    },
});
